import org.w3c.dom.ls.LSOutput;

import java.util.Arrays;
import java.util.EnumSet;

public class ArrayHomework
{
    public static void main(String[] args)
    {
        int[] arr = {1,0,2,4};
        double[] darr = {0.1,0.5,0.6,0.7};
        System.out.println(Arrays.toString(copyOF(arr)));
        System.out.println(Arrays.toString(twoArray(arr)));
        System.out.println((argArray(darr)));

    }


    public static double argArray(double[] array)
    {
        int len = array.length;
        double sum =0;
        for (double v : array) {
            sum += v;
        }
        return sum;
    }

    public static int[] twoArray(int[] array)
    {
        int len=array.length;
        if(len==0) return array;
        for(int i=0;i<len;i++)
        {
            array[i]*=2;
        }
        return array;
    }

    public static int[] copyOF(int[] array)
    {
        int len =array.length;
        if(len==0) return null;
        int[] newArr = new int[len];
        int cnt=0;
        for(int i:array)
        {
            newArr[cnt++]=i;
        }
        return newArr;
    }
}
